﻿using System;
using System.Data;
using System.Configuration;

using System.Web;

using DatabaseService;

/// <summary>
/// Summary description for GoldenPrice_Factory
/// </summary>
/// 
namespace SJCGoldenPrice
{

    public class SJC_Factory
    {
        public Price Hcm = new Price();
        public Price Ha_noi = new Price();
        public Price Da_nang = new Price();
        public Price Nha_trang = new Price();
        public Price Can_tho = new Price();

        public SJC_Factory()    
            
        {

        }

        public void getPrice(string className)
        {
            Object obj = Activator.CreateInstance(Type.GetType("SJCGoldenPrice." + className));
            GoldenPrice GP = obj as GoldenPrice;
            GP.getPrice();
            this.Ha_noi = GoldenPrice.UniqueInstance.Ha_noi;
            this.Hcm=GoldenPrice.UniqueInstance.Hcm  ;
            this.Nha_trang=GoldenPrice.UniqueInstance.Nha_trang;
            this.Can_tho=GoldenPrice.UniqueInstance.Can_tho;
            this.Da_nang=GoldenPrice.UniqueInstance.Da_nang;

        }

        public bool writeToDB(string className)
        {
            this.getPrice(className);
            AccessDB.InsertSJCPriceDB(this, className);
            return true;
        }
    }
}